<template>
  <div class="person">
    <h2>汽车信息：一台{{ car.brand }}汽车，价值{{ car.price }}万</h2>
    <button @click="changeCarPrice">修改汽车价格</button>

    <button @click="changeModel">修改汽车模型</button>
  </div>
</template>

<script lang="ts" setup name="Person">
import { reactive, ref} from 'vue'

// 数据
let car = reactive({ brand: '奔驰', price: 100 })

console.log(car)

function changeCarPrice() {
  car.price += 10
}
function changeModel(){
  let newcar = {brand: '奥迪', price: 999 }
  Object.assign(car,newcar)
}
</script>